        // pages/caicaicai/index.js
let numComputer,numUser,min=0,max=100,list=[];
Page({
  data:{
    min:0,
    max:100,
    list:[],
  },
  onLoad(options) {
   numComputer = parseInt(Math.random()*99)+1;
    console.log('计算机想的数据',numComputer);
  },
  input(e) {
    numUser = parseInt(e.detail.value||0);
    console.log('用户猜想数据:' ,numUser);
  },
  caicaicai(e) {
    let message=null
    if(numComputer>numUser) {
      message='Sorry,猜小了~'
      if(min<numUser)min=numUser
    }else if(numComputer<numUser) {
      message='Sorry,猜大了~'
      if(max>numUser)max=numUser
    }else{
      message='恭喜你，猜对了~'
    }
    list.push(numUser)
    console.log('执行猜猜猜：',message)
    this.setData({
      result:message,
      focus:true,
      value:'',
      lastNumber:numUser,
      min:min,
      max,
      list,
    })
  },
})
